package com.zzq.base.awesome.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {
    private List<T> data;
    private long pageNo;
    private long pageSize;
    private long totalCount;
    private long totalPage;

    public static<T> PageResult<T> wrapIPage(IPage<T> page){
        PageResult pageResult = new PageResult();
        pageResult.setData(page.getRecords());
        pageResult.setPageNo(page.getPages());
        pageResult.setPageSize(page.getSize());
        pageResult.setTotalCount(page.getTotal());
        pageResult.setTotalPage(page.getPages());
        return pageResult;
    }

}
